<?php

class CheckoutCart extends CI_Controller {
	const view_page = "order/checkoutCart";
	function index()
	{
		echo "The Cart Info:<br/>";
	}
	
	function testCart()
	{		
		 //echo "Welcome to orderdetail\n";
		$this->load->model('cart_model');
		$cart = $this->cart_model->getCartInfo();
		$data['title'] = "order Detail Page";
		$data['cart'] = $cart;
		$this->load->view(self::view_page, $data);
		 
	}
	
	function addFood($foodID,$quantity)
	{
		$this->load->model('cart_model');
		$cart = $this->cart_model->addFood($foodID,$quantity);

		$data = array();
		$data['cart'] = $cart;
		$this->load->view(self::view_page, $data);
	}
	
	function substractFood($foodID,$quantity)
	{
		$this->load->model('cart_model');
		$cart = $this->cart_model->substractFood($foodID,$quantity);
		$data = array();
		$data['cart'] = $cart;
		$this->load->view(self::view_page, $data);
	}
	
	function removeFood($foodID)
	{
		$this->load->model('cart_model');
		$cart=$this->cart_model->removeFood($foodID);
		$data = array();
		$data['cart'] = $cart;
		$this->load->view(self::view_page, $data);
	}
	
	function getCartInfo()
	{
		$this->load->model('cart_model');
		$cart = $this->cart_model->getCartInfo();
		echo "The Cart Info:<br/>";
		print_r($cart);
		echo "<br/>____________________<br/>";
		return $cart;
	}
}